var Express = require('express'),
    Router = Express.Router(),

    userPolicy = require('../policies/policy'),

    userController = require('../controllers/user.controller');

Router.route('/register').all().post(userController.register);

Router.route('/login').all().post(userController.login);

Router.route('/me').all().post(userController.me);

Router.route('/getAllUsers').all(userPolicy.isAllowed).get(userController.getAllUsers);

Router.route('/activate/:id').all().get(userController.activateID);

Router.route('/deactivate/:id').all().get(userController.deactivateID);

Router.route('/changepassword').all().post(userController.changepassword);

Router.route('/confirm').all().get(userController.confirm);

Router.route('/forgotpassword').all().post(userController.forgotpassword);

Router.route('/tokenCheck').all().post(userController.tokenCheck);

Router.route('/passwordreset').all().post(userController.passwordreset);

Router.route('/logout').all().post(userController.logout);

Router.route('/getAuthor').all(userPolicy.isAllowed).post(userController.getAuthor);

Router.route('/viewProfile').all(userPolicy.isAllowed).post(userController.viewProfile);

Router.route('/updateProfile').all(userPolicy.isAllowed).post(userController.updateProfile);

Router.route('/uploadCropped').all(userPolicy.isAllowed).post(userController.uploadCropped);

Router.route('/countries').all(userPolicy.isAllowed).get(userController.countries);

Router.route('/getAdminUsers').all(userPolicy.isAllowed).post(userController.getAdminUsers);

Router.route('/updateStatus').all(userPolicy.isAllowed).post(userController.updateStatus);

Router.route('/addUser').all(userPolicy.isAllowed).post(userController.addUser);

Router.route('/editUser').all(userPolicy.isAllowed).post(userController.updateUserInfo);

Router.route('/getRecentUsers').all(userPolicy.isAllowed).post(userController.getRecentUsers);

Router.route('/editRole').all(userPolicy.isAllowed).post(userController.editRole);

Router.route('/saveIdea').all(userPolicy.isAllowed).post(userController.saveIdea);

Router.route('/getSavedIdea').all(userPolicy.isAllowed).get(userController.getSavedIdea);

module.exports = Router;
